﻿using System.Collections.Generic;
using GISServer.Core.Client.Geometry;
using Newtonsoft.Json;

namespace GISServer.Core.Client
{
    public class Feature
    {

        [JsonProperty("geometry")]
        public Geometry.Geometry Geometry { get; set; }

        [JsonProperty("attributes")]
        public Attributes Attributes { get; set; }

        public string ToJson()
        {
            if ((this.Geometry.GetType().Name == "Polygon") || (this.Geometry.GetType().Name == "Polyliine") || (this.Geometry.GetType().Name == "MultiPoint"))
            {
                return Utilities.Serializer.ToJson4Collection(this);
            }
            else
            {
                return Utilities.Serializer.ToJson(this);
            }
        }
    }
}
